package com.slz3.business.module.configManagement.conIndexShowImg.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.configManagement.conIndexShowImg.domain.ConIndexShowImg;
import com.slz3.business.module.configManagement.conIndexShowImg.domain.ConIndexShowImgFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class ConIndexShowImgTransactionalServiceImpl implements ConIndexShowImgTransactionalService {

    @Override
    public ConIndexShowImg modify(ConIndexShowImg conIndexShowImgNew) {
        Repositorys.conIndexShowImg.test();
        Repositorys.conIndexShowImg.save(ConIndexShowImgFactory.initBaseFields());
        System.err.println(1/0);
        conIndexShowImgNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.conIndexShowImg.saveAndFlush(conIndexShowImgNew);
    }

    @Override
    public List<ConIndexShowImg> batchModify(List<ConIndexShowImg> conIndexShowImgList) {
        return Repositorys.conIndexShowImg.saveAll(conIndexShowImgList);
    }
}
